<template>
	<view>
		<view v-if="PageCur=='home'">
			<home ref="cc"></home>
		</view>
		<call v-if="PageCur=='call'"></call>
		<my v-if="PageCur=='my'"></my>

		<!-- 自定义tabs -->
		<view class="cu-bar tabbar bg-white shadow foot">
			<view class="action" @click="NavChange" data-cur="home">
				<view class='cuIcon-cu-image'>
					<text class="cuIcon-shouye" :class="PageCur=='home' ? 'selected-blue': 'no-select'"></text>
				</view>
				<view :class="PageCur=='home'?'text-system-color-blue':'text-gray'">首页</view>
			</view>
			<view v-if="isAdmin" class="action" @click="NavChange" data-cur="call">
				<view class='cuIcon-cu-image'>
										<text class="cuIcon-yijianbaojing" :class="PageCur=='call' ? 'selected-blue': 'no-select'"></text>
				</view>
				<view :class="PageCur=='call'?'text-system-color-blue':'text-gray'">一键报警</view>
			</view>
			<view class="action" @click="NavChange" data-cur="my">
				<view class='cuIcon-cu-image'>
					<text class="cuIcon-gerenzhongxin" :class="PageCur=='my' ?'selected-blue':  'no-select'"></text>
				</view>
				<view :class="PageCur=='my'?'text-system-color-blue':'text-gray'">个人中心</view>
					
			</view>
		</view>

		<view class="cu-modal" :class="alertModal">
			<view class="cu-dialog">
				<view class="bg-img" :style="{backgroundImage: 'url('+alertImg+')'}"> </view>
				<view class="cu-bar bg-white" style="display: flex;flex-direction: column;">
					<view class="padding-xl" style="color: red;">{{alertTitle}}</view>
					<text style="width: 80%;text-align: center;margin-bottom: 40rpx;">{{alertMsg}}</text>
					<view style="line-height: 30px;margin: 10rpx; 100rpx;height: 60px; width: 40%;"
						class="action bg-system-orange flex-sub  solid-left" @tap="sub">确认</view>
				</view>
			</view>
		</view>

		<message />
	</view>
</template>

<script>
	import * as constants from '@/common/config.js';
	const app = getApp()
	export default {
		onShow(option) {
			if (option !== undefined && option !== null && option !== "") {
				if (option.type === "refreshPage") {
					uni.showToast({
						title: "正在刷新...",
						icon: 'loading'
					})
					uni.$emit('refreshPage', {})
				}
			}
		},
		data() {
			return {
				PageCur: 'home',
				isAdmin: false,
				alertModal: '',
				alertTitle: 'xxx',
				alertMsg: 'xxxxx',
				alertImg: '',
				infoType: '',
				noticeInfoId: '',
				equRounds: false,
				ucId: '',
				bgAudioManager: null,
				audioId: 0,
				noticeInfo: {}
			}
		},
		methods: {
			NavChange: function(e) {
				this.PageCur = e.currentTarget.dataset.cur
			},
			
		},
		destroyed() {
		},
		onLoad() {
			if (getApp().globalData.role == 'D') {
				this.isAdmin = true;
			} else {
				this.isAdmin = false;
			}
		}	
	}
</script>

<style scoped>
	.bg-img {
		height: 400rpx;
	}
	.selected {
		color: #FCAA19;
	}
	.selected-blue {
	color: #1A66FF;
	}
	.no-select {
		color: #777777;
	}
</style>
